/**  
 * All rights Reserved, Designed By <a href="www.itttq.com" target="_blank">www.itttq.com</a>
 * @date:   2017-07-21 11:42:21
 * @Copyright: 2017 <a href="www.itttq.com" target="_blank">www.itttq.com</a> Inc. All rights reserved. 
 */
package com.itttq.gshop.pbpm.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.itttq.gshop.domain.po.SysNoticePo;
import com.itttq.gshop.domain.to.ResultPageTo;
import com.itttq.gshop.pbpm.mapper.ISysNoticeMapper;

@Service
public class SysNoticeService {
	@Autowired
	private ISysNoticeMapper sysNoticeMapper;
	
	/**
	 * 根据ID获取SysNoticePo对象
	 * 
	 * @param id
	 * @return
	 * @Author 迷蝶
	 * @return SysNoticePo
	 */
	public SysNoticePo getSysNotice(int id) {
		return sysNoticeMapper.findSysNoticeById(id);
	}
	
	/**
	 * 根据条件获取SysNoticePo对象，并返回查询的数据总数
	 * 
	 * @param sysNotice
	 * @Author 迷蝶
	 * @return ResultPageTo<SysNoticePo>
	 */
	public ResultPageTo<SysNoticePo> getSysNotices(SysNoticePo sysNotice) {
		return new ResultPageTo<SysNoticePo>(sysNotice.getStart(), sysNotice.getSize(), 
				sysNoticeMapper.findSysNoticeCount(sysNotice), sysNoticeMapper.findSysNotices(sysNotice));
	}
	
	/**
	 * 根据条件获取SysNoticePo对象，不返回查询的数据总数
	 * 
	 * @param sysNotice
	 * @Author 迷蝶
	 * @return List<SysNoticePo>
	 */
	public List<SysNoticePo> getNotices(SysNoticePo sysNotice) {
		return sysNoticeMapper.findSysNotices(sysNotice);
	}
	
	/**
	 * 根据ID删除SysNoticePo对象
	 * 
	 * @param id
	 * @Author 迷蝶
	 */
	public Integer delSysNotice(int id) {
		return sysNoticeMapper.delSysNoticeById(id);
	}
	
	/**
	 * 增加SysNoticePo对象
	 * 
	 * @param sysNotice
	 * @Author 迷蝶
	 */
	public Integer addSysNotice(SysNoticePo sysNotice) {
		return sysNoticeMapper.addSysNotice(sysNotice);
	}
	
	/**
	 * 根据条件更新SysNoticePo对象
	 * 
	 * @param sysNotice
	 * @Author 迷蝶
	 */
	public Integer updateSysNotice(SysNoticePo sysNotice) {
		return sysNoticeMapper.updateSysNotice(sysNotice);
	}
	
}
